#include <iostream>

using namespace std;

void swap(int a, int b){
    int temp = a;
    a = b;
    b = temp;
}

int main(){

    int a = 10;
    int b = 20;

    cout << "交换前" << endl;
    cout << "a = " << a << ", b = " << b << endl;
    // 值传递，函数内部对参数的修改不会影响原变量
    swap(a, b);
    cout << "交换后" << endl;
    cout << "a = " << a << ", b = " << b << endl; 

    return 0;
}
